<%@ Page Language="VB" MasterPageFile="~/Admin/Admin.master" AutoEventWireup="false" CodeFile="AssessmentActivityCosts.aspx.vb" Inherits="RIAssessments_AssessmentActivityCosts" title="Assessment Admin - Activity Costs" %>
<%@ Register Src="AssessmentSubNavControl.ascx" TagName="AssessmentSubNavControl" TagPrefix="uc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder2" Runat="Server">
<script type="text/javascript">
    function CalculateNewValues(percentChange, gridName) {
    
        var currentCost;
        var percentageAmount;
        var calculation;
        var grid = document.getElementById(gridName);
        
        if (!isNaN(percentChange)) {
        
            if (document.all) {

                for (i=0; i<=grid.all.length - 1; i++) {
                
                    if (grid.all(i).id.indexOf('UnitTimeLabel') != -1) {
                        currentCost = grid.all(i).innerHTML;
                        currentCost = currentCost.replace('$', '');
                        currentCost = parseFloat(currentCost);
                    } else if (grid.all(i).id.indexOf('UnitTimeTextBox') != -1) {
                        percentageAmount = (currentCost * (percentChange / 100));
                        calculation = currentCost + percentageAmount;
                        calculation = calculation.toFixed(2);
                        grid.all(i).value = calculation;
                    }
                    
                }
                
            } else {
                return true;
            }
        
        } else {
            alert('Percent increase must be a number.');
        }
        
        return false;
        
    }
</script>

<uc1:AssessmentSubNavControl ID="AssessmentSubNavControl1" runat="server" />

<div style="height:320px;">
<div id="PageDiv" runat="server" style="position:relative; left:20px; top:0px; width:944px; height:290px; overflow:auto;">
    <table border="0" cellpadding="4" cellspacing="0" style="font-family:MS Sans Serif, Arial, Verdana, Sans-Serif; font-size: 1em;">
        <tr>
            <td style="font-weight:bold; color:#21334B; width: 300px;">Admin - Assessment Activity Times</td>
            <td align="right" style="width: 590px;"><asp:Label ID="MessageLabel" runat="server" ForeColor="navy" Font-Names="ms sans serif,arial,verdana,helvetica,sans-serif" Font-Size="9pt" Visible="False"></asp:Label></td>
        </tr>
        <tr style="font-size: 9pt; font-family:ms sans serif,arial,verdana,helvetica,sans-serif;">
            <td colspan="2" align="right" valign="middle"><asp:Label ID="PercIncLabel" runat="server" AssociatedControlID="PercentIncreaseTextBox" Text="Percent Increase"></asp:Label>&nbsp;<asp:TextBox ID="PercentIncreaseTextBox" runat="server" Width="40px"></asp:TextBox>&nbsp;%&nbsp;&nbsp;<asp:Button ID="CalculateNewValuesButton" runat="server" Text="Calculate New Values" /></td>
        </tr>
        <tr>
            <td colspan="2">
                <asp:GridView ID="AssessmentActivityCostGridView" runat="server" HorizontalAlign="center" Width="858px" CellPadding="5" 
                        AutoGenerateColumns="False" ShowFooter="True" BorderColor="#21334B" DataKeyNames="AssessmentActivityTimeId,AssessmentActivityId" BorderStyle="Solid" GridLines="Vertical">
                    <HeaderStyle CssClass="adminHeaderStyle" BackColor="#C3CAD4" BorderColor="#21334B" VerticalAlign="Top" />
                    <RowStyle CssClass="adminColumnStyle" />
                        <Columns>
                            <asp:TemplateField HeaderText="Assessment Activity">
                                <ItemStyle Width="251px" />
                                <ItemTemplate>
                                    <asp:Label ID="AssessmentActivityLabel" runat="server" Text='<%#Eval("AssessmentActivity") %>'></asp:Label>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Unit Time" SortExpression="UnitTime">
                                <ItemStyle Width="117px" HorizontalAlign="Center"/>
                                <ItemTemplate>
                                    <asp:Label ID="UnitTimeLabel" runat="server" Text='<%#Eval("UnitTime")%>'></asp:Label>    
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="New Unit Time">
                                <ItemStyle Width="117px" HorizontalAlign="Center" VerticalAlign="Middle" />
                                <ItemTemplate>
                                    <asp:TextBox ID="NewUnitTimeTextBox" runat="server" Width="60px"></asp:TextBox>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Functional Unit Time" SortExpression="FunctionalUnitTime">
                                <ItemStyle Width="117px" HorizontalAlign="Center" />
                                <ItemTemplate>
                                    <asp:Label ID="FunctionalUnitTimeLabel" runat="server" Text='<%#Eval("FunctionalUnitTime")%>'></asp:Label>    
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="New Functional Unit Time">
                                <ItemStyle Width="117px" HorizontalAlign="Center" VerticalAlign="Middle" />
                                <ItemTemplate>
                                    <asp:TextBox ID="NewFunctionalUnitTimeTextBox" runat="server" Width="60px"></asp:TextBox>
                                </ItemTemplate>
                                <FooterTemplate>
                                    New Effective Date:&nbsp;
                                    <asp:TextBox ID="EffectiveDateTextBox" runat="server" Width="120px"></asp:TextBox>
                                </FooterTemplate>
                                <FooterStyle HorizontalAlign="Right" BackColor="WhiteSmoke" Font-Size="9pt" Font-Names="MS Sans Serif, Arial, Verdana, Sans-Serif" />
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Effective Date" SortExpression="EffectiveDate">
                                <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="137px" />
                                <ItemTemplate>
                                    <asp:Label ID="EffectiveLabel" runat="server" Text='<%#Eval("EffectiveDate")%>'></asp:Label>
                                </ItemTemplate>
                            </asp:TemplateField>
                        </Columns>
                    <AlternatingRowStyle BackColor="#E8ECF4" />
                </asp:GridView>                    
            </td>
        </tr>
    </table>
</div>

<asp:HiddenField ID="LastEffectiveDateHidden" Value="" runat="server" />

</div>
</asp:Content>
<asp:Content ID="FixedContent" runat="server" ContentPlaceHolderID="ContentPlaceHolderFixedAdmin">
                <asp:Button ID="SaveButton" runat="server" Text="Save" Width="100px" />
</asp:Content>
